<!-- the detail of a project -->
<?php 
//设置标题
$_title="新增项目模块";
include_once("../header.php")
 ?>
<body class="metrouicss">
    <!-- top -->
    <?php include_once("../menu.php") ?>
    <div id="page-index" class="page">
      <div class="page-region">
        <div class="page-region-content">
          <div class="grid">
            <div class="row ">
              <div>
                <i class="icon-arrow-left-3" style="font-size:69px;"></i>
                <span style="margin-left:30px;font-size:40px;">返回</span>
                <a>项目管理</a>
              </div>
            </div>
          </div>
          <!-- grid1 -->
          <div class="grid">
            <div class="row">
              
              <!-- 项目统计 -->
              <div class="span4">
                <div class="tile double bg-color-blueDark" data-param-period="3800" data-role="tile-slider" data-param-direction="right">
                  <div class="tile-content">
                    <h2>项目管理模块</h2>
                    <h5>进度情况</h5>
                    <p>项目负责人：用户名</p>
                  </div>
                  <div class="tile-content">
                    <h2>描述</h2>
                    <p>项目负责人：用户名</p>
                    <p>项目负责人：用户名</p>
                    <p>项目负责人：用户名</p>
                    <p>项目负责人：用户名</p>
                  </div>
                  <div class="brand">
                    <div class="badge">90%</div>
                    <i class="icon-chrome icon" style="font-size:29px;"></i>
                  </div>
                </div>
                <div class="tile double bg-color-pink" data-param-period="3500" data-role="tile-slider" data-param-direction="left">
                  <div class="tile-content">
                    <h2>其他</h2>
                    <h5>进度情况</h5>
                    <p>项目负责人：用户名</p>
                  </div>
                  <div class="tile-content">
                    <h2>描述</h2>
                    <p>项目负责人：用户名</p>
                    <p>项目负责人：用户名</p>
                    <p>项目负责人：用户名</p>
                    <p>项目负责人：用户名</p>
                  </div>
                  <div class="brand">
                    <div class="badge">60%</div>
                    <i class="icon-opera icon" style="font-size:29px;"></i>
                  </div>
                </div>
              </div>
               <!-- 表单 -->
              <div class="span8">
                <h2>新增模块</h2>
                <form id="addFrom" action="../../ctl/index.php?ctl=Module&ac=addRec" method="POST">
                  <!-- strname strdemo ftpercent strduty dtcreate dtupdate dtexpect dtfinish intstatus ftrate  -->
                  <input type="hidden" name="m[:strproid]" value="<?= $_GET['strproid']?>"/>
                   模块名称
                  <div class="input-control text">                   
                    <input type="text" name="m[:strname]"/>
                    <button class="helper"></button>
                  </div>
                  负责人
                  <div class="input-control text">
                    <input type="text" name="m[:strduty]"/>
                    <button class="helper"></button>
                  </div>
                    预期完成日期
                  <div class="input-control text">
                    <input type="text" name="m[:dtexpect]"/>
                    <button class="helper"></button>
                  </div>
                    占项目比重
                  <div class="input-control text">
                    <input type="text" name="m[:ftpercent]"/>
                    <button class="helper"></button>
                  </div>
                    完成比例
                  <div class="input-control text">
                    <input type="text" name="m[:ftrate]"/>
                    <button class="helper"></button>
                  </div>
                    模块描述
                  <div class="input-control textarea">
                    <textarea name="m[:strdemo]"></textarea>
                  </div>
                  <div class="place-right">
                    <input type="submit" value="提交"/>&nbsp;
                    <input type="reset" value="重置"/>
                  </div>
                </form>
              </div>

            </div>
          </div>          
          <!-- grid1 end -->
          <?php 
          //$url=$_SERVER['PHP_SELF'];
          //echo "<p>".str_replace('/','_',$url)."</p>";
          ?>
        </div>
      </div>
    </div>
    <?php include_once("../bottom.php") ?>
    <script>
     $(document).ready(function()
                       {       
                        asyncMethod('ctl=Module&ac=details',initModule);
                        //asyncMethod('ctl=Project&ac=detail',getInfo);
                        });
     //ajax method
     function asyncMethod(url,callback)
     {
       $.ajax({
         url:'../../ctl/index.php?'+url,
         method:'get',
         dataType:'json',
         data:{
           strproid:"<?= !isset($_GET['strproid'])?'-1':$_GET['strproid']?>"
         },
         success:function(data){
           if(data.status=='suc')
           {
             callback(data);
           }
         },
         error:function(){
           alert("ajax error");
         }
       });
     }
     function initModule(data)
     {
       if(data.modules.length==0)
       {
         return;
       }
       var modules = data.modules;
       $.each(modules,function(i){
         var app = "<div class='tile double bg-color-green' data-param-period='3000' data-role='tile-slider' onclick=\"javascript:window.location.href='./moduleDetail.php?strmid="+decodeURI(modules[i].strmid)+"'\" >";
         app += "<div class='tile-content'>";
         app += "<h2>"+decodeURI(modules[i].strname)+"</h2>";
         app += "<h5>进度情况&nbsp;"+modules[i].ftrate+"%</h5>"
         app += "<p>项目负责人&nbsp;"+modules[i].strduty+"</p>";
         app += "</div>";
         app += "<div class='tile-content'>";
         app += "<h2>项目模块描述</h2>";
         app += "<p>"+decodeURI(modules[i].strdemo)+"</p>";
         app += "</div>";
         app += "<div class='brand'>";
         app += "<div class='badge'>"+modules[i].ftrate+"%</div>";
         app += "<i class='icon-chrome icon' style='font-size:29px;'></i>";
         app += "</div>";
         app += "</div>";
         $("div.span4").append(app);
         var slidedTiles = $('[data-role=tile-slider],.block-slider,.tile-solider');
         slidedTiles.each(function(index,tile){
           var params = {};
           tile = $(tile);
           params.direction = tile.data('paramDirection');
           params.duration = tile.data('paramDuration');
           params.period = tile.data('paramPeriod');
           tile.tileBlockSlider(params);
         });
       });
     }
     //add project module
     function addModule()
     {
       
     }
     function getInfo(data)
     {
       var info = data.detail;
       if(!info)return;
       $("a[name='Name']").html(info.strname);
       $("a[name='Admin']").html(info.strduty);
       $("a[name='Dtexpect']").html(info.dtexpect);
       $("a[name='Demo']").html(info.strdemo);
     }
     function render(data)
     {
       // For horizontal bar charts, x an y values must will be "flipped"
       // from their vertical bar counterpart.
       var plot2 = $.jqplot('chart1',[data.modules], {
         
           seriesDefaults: {
             renderer:$.jqplot.BarRenderer,
             // Show point labels to the right ('e'ast) of each bar.
             // edgeTolerance of -15 allows labels flow outside the grid
             // up to 15 pixels.  If they flow out more than that, they
             // will be hidden.
             pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
             // Rotate the bar shadow as if bar is lit from top right.
             shadowAngle: 135,
             // Here's where we tell the chart it is oriented horizontally.
             rendererOptions: {
               barDirection: 'horizontal'
             }
           },
           axes: {
             yaxis: {
               renderer: $.jqplot.CategoryAxisRenderer
             }
           }
         });
     }
     function addRec()
     {
       $.ajax({
         url:'../../ctl/index.php?ctl=Project&ac=addRec',
         method:'POST',
         dataType:'json',
         data:$("form:first").serialize(),
         success:function(data){
           if(data.status=='suc')
           {
             $("#proLink").attr("href","./projectInfo.php?strproid="+data.strproid);
             $("form:first input").each(function(i){
               if($(this).attr("type")=="text")$(this).replaceWith("<p><i class='icon-arrow-right' style='font-size:25px;'></i><a style='font-size:30px;'>&nbsp;&nbsp;&nbsp;"+$(this).val()+"</a></p>");
               else 
               $(this).hide();
             });
             $("form:first textarea").each(function(i){$(this).replaceWith("<p><i class='icon-tag' style='font-size:25px;'></i><a style='font-size:30px;'>&nbsp;&nbsp;&nbsp;"+$(this).val()+"</a></p>")});
             $("form:first button").each(function(i){$(this).hide();});
             $("ul.replies").css("display","block");
           }
         },
         error:function(){
           alert("errorssss");
         }
       });
       return false;
     }
    </script>
  </body>
</html>